package com.zxy.supplier_system.server.controller

import com.zxy.supplier_system.server.entity.MarketShoppingGuideSalaryPlanResult
import com.zxy.supplier_system.server.service.MarketShoppingGuideSalaryPlanResultService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import java.math.BigDecimal

@RequestMapping("markets/{marketId}/shoppingGuideSalaryPlanResults/year/{year}/month/{month}")
@RestController
class MarketShoppingGuideSalaryPlanResultController(
    private val marketShoppingGuideSalaryPlanResultService: MarketShoppingGuideSalaryPlanResultService
) {

    @GetMapping("plan")
    fun getCopiedPlan( @PathVariable marketId: Int, @PathVariable month: Int,
                      @PathVariable year: Int
    ) : MarketShoppingGuideSalaryPlanResultPlanResponse{
        return this.marketShoppingGuideSalaryPlanResultService.getCopiedPlan(marketId,year,month)
    }

    data class MarketShoppingGuideSalaryPlanResultPlanResponse(
        val minimumSalary: BigDecimal?,
        val rules: List<MarketShoppingGuideSalaryPlanResult.MarketShoppingGuideSalaryRuleData>
    )

}